package com.cheng.sell.converter;

import com.cheng.sell.dto.OrderMasterDTO;
import com.cheng.sell.entity.OrderMaster;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * Description:
 * </p>
 *
 * @author chengxintao
 * @version 1.0
 * <p>
 * <p>
 * History:
 * <p>
 * Date                 Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2018/8/27         chengxintao          1.0         To create
 * </p>
 * @see
 * @since
 */
public class OrderMaster2OrderMasterDTOConverter {
    public static OrderMasterDTO converter(OrderMaster orderMaster) {
        OrderMasterDTO orderMasterDTO = new OrderMasterDTO();
        BeanUtils.copyProperties(orderMaster, orderMasterDTO);
        return orderMasterDTO;
    }

    public static List<OrderMasterDTO> convert(List<OrderMaster> orderMasterList) {
        return orderMasterList.stream().map(e -> converter(e)).collect(Collectors.toList());
    }
}
